Skip to content

SPI: Fix discarded-qalifiers warning when compiling with all warnings #3458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 11, 2019

Conversation

davefiddes
Copy link
Contributor

@davefiddes davefiddes commented Nov 7, 2019

This fixes an error introduced with changeset b847f41 which
tightened the use of const for read-only data. The helper
function __transferBytes also requires the const qualifier on
outgoing data. Without this change a warning is displayed
when compiling with the Arduino IDE set to display "All"
compiler warnings.

Local functions __transferBytes() and __spiTranslate32() are now marked as static.

Unused local function __spiTranslate24() has been removed.

Tests:

  • Build an ESP32 SPI sketch that uses static const data to send
    to an SPI device using the SPI.transferBytes() API

This fixes an error introduced with changeset b847f41 which
tightened the use of const for read-only data. The helper
funtion __transferBytes also requires the const qualifier on
outgoing data. Without this change a warning is displayed
when compiling with the Arduino IDE set to display "All"
compiler warnings.

Tests:
 - Build an ESP32 SPI sketch that uses static const data to send
   to an SPI device using the SPI.transferBytes() API
@me-no-dev
Copy link
Member

please mark the method as static as well :)

This audits all functions in the esp32-hal-xpi.c module and
ensures that any functions entirely local to the module are
marked as static.

Tests:
 - Build with Arduino set to show all warnings and ensure none
   are displayed
This removes the __spiTranslate24() function which is unused.
@me-no-dev
Copy link
Member

thanks :)

@me-no-dev me-no-dev merged commit dac493f into espressif:master Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants